<template>
    <div class="find-music">
        <banner />
        <nav-bar />
        <music-list-item :list="recommendSongs"><span>推荐歌单</span></music-list-item>
        <song-list-item :listInfo="listInfo" ><span>最新音乐</span></song-list-item>
        <music-list-item :list="radioList"><span>推荐电台</span></music-list-item>
        <music-list-item :list="mvList"><span>推荐mv</span></music-list-item>
        <music-list-item :list="excList"><span>独家放送</span></music-list-item>
    </div>
</template>
<script>
import Vue from 'vue';
import { Lazyload } from 'vant';
Vue.use(Lazyload);
import banner from './banner'
import navBar from './nav-bar'
import musicListItem from './music-list-item'
import songListItem from './song-list-item'
export default {
    name:'findMusic',
    components:{
        musicListItem,
        songListItem,
        navBar,
        banner
    },
    data() {
        return {
            recommendSongs:[],
            listInfo:{},
            radioList:[],
            mvList:[],
            excList:[]
        }
    },
    methods:{
        //获取推荐歌单
        getRecommendSongs() {
            this.Public.recommend.recommendSongs({limit:6}).then(res => {
                if(res.code == 200){
                    this.recommendSongs = res.result
                }
            })
        },
        //获取最新音乐
        getRecommendNewSongs() {
            this.Public.recommend.recommendNewSongs().then(res => {
                let songs = [];
                if(res.code == 200) {
                    this.listInfo = {
                        newSongs1:res.result.slice(0,3),
                        newSongs2:res.result.splice(3,3)
                    }
                }
            })
        },
        //获取最新专辑
        getNewDishesTop() {
            this.Public.recommend.getNewDishesTop().then(res => {

            })
        },
        //推荐电台
        getRecommendRadio() {
            this.Public.recommend.recommendRadioList().then(res =>{
                if(res.code == 200) {
                    this.radioList = res.result
                }
            })
        },
        //推荐mv
        getRecommendMv() {
            this.Public.recommend.recommendMvList().then(res =>{
                if(res.code == 200) {
                    this.mvList = res.result.splice(0,3)
                }
            })
        },
        //独家放送
        getExclusiveDis() {
            this.Public.recommend.getExclusiveDis().then(res =>{
                if(res.code == 200) {
                    this.excList = res.result.splice(0,3)
                }
            })
        },
    },
    created() {
        this.getRecommendSongs()
        this.getRecommendNewSongs()
        this.getRecommendRadio()
        this.getRecommendMv()
        this.getExclusiveDis()
    }
}
</script>
<style lang="less" >
    .find-music{
        padding:90px 20px 0px 20px;
       
    }
</style>